//
//  NSString+NSStringEx.m
//  ChatInterface_QQ
//
//  Created by admin on 2019/9/1.
//  Copyright © 2019 猫爷爷的酱醋茶. All rights reserved.
//

#import "NSString+NSStringEx.h"

@implementation NSString (NSStringEx)

//对象方法
- (CGSize)sizeOfTextWithMaxSize:(CGSize)maxSize font:(UIFont *)font
{
    NSDictionary *atts = @{NSFontAttributeName : font};
    return [self boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:atts context:nil].size;
}

//类方法
+ (CGSize)sizeWithText:(NSString *)text maxSize:(CGSize)maxSize font:(UIFont *)font
{
    return [text sizeOfTextWithMaxSize:maxSize font:font];
}

@end
